/*----------------------------------------------------------------------
 *			SW Flash/SDRAM Download Configuration Script
 * Note:
 *	 Work Mode:Support different work mode,but OTP+ROM mode work on FPGA platform only,Flash only mode must select the VECTRESET reset
 *   Hardware Platform:You can select FPGA test platform or ASIC chip platform
 *   Oscillator Select:Select external oscillator,it can speed up the download,if you cannot be
                       sure,select 'None'
 *   Fast Erase:Merge the multi-sectors erase into block erase,if signal of board not good,select 'Normal'
 *   Lock Range:prevent data damage from write protection 
 *   Debug Port:downloader debug interface
 *-----------------------------------------------------------------------*/

FUNC void Setup (void) {
    //Work Mode[0:OTP only,1:OTP+FLASH,2:OTP+SDRAM,3:OTP+ROM,4:FLASH only,5:SDRAM Test]
    _WDWORD(0x20007C00,1);

    //Hardware Platform[0:ASIC platform,1:FPGA platform]
    _WDWORD(0x20007C04,0);

    //Oscillator Select[-1:None,0:32K,1:1M,2:2M,...,31:31M]
    _WDWORD(0x20007C08,-1);

    //Fast Erase[0:Nomal,1:Fast]
    _WDWORD(0x20007C0C,0);

    //Lock Range[0:None,1:50%,2:75%,3:87.5%,4:100%]
    _WDWORD(0x20007C10,0);
    
    //Debug Port[0:port 0,1:port 1,2:port 2,-1:none]
    _WDWORD(0x20007C14,-1);
    
    //Flash GPIO??[0:GPIO group 0,1:GPIO group 1,2:GPIO group 2,3:GPIO group 3]
    //_WDWORD(0x20007C18,0);
}

Setup();
